home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / game / patch / WHDIDemos.lzh / Union_HnD.lha / H'n'D Install / Install < prev    next >
Text File  |  2001-06-16  |  5KB  |  230 lines

  1. ;****************************
  2.  
  3. (set #readme-file "ReadMe")    ;name of the readme file
  4.  
  5. (procedure P_MakeImages
  6.  
  7.   ;the following lines must be copied and adjusted for multiple disk images
  8.  
  9.   (set #CI_disknum 1)
  10.   (set #CI_diskname ("%s Disk %ld" @app-name #CI_disknum))
  11.   (set #CI_disklen 901120)
  12.   (set #CI_skiptrk -1)
  13.   (P_CreateImage)
  14.  
  15.   (set #CI_disknum 2)
  16.   (set #CI_diskname ("%s Disk %ld" @app-name #CI_disknum))
  17.   (set #CI_disklen 901120)
  18.   (set #CI_skiptrk -1)
  19.   (P_CreateImage)
  20.  
  21. )
  22.  
  23. ;****************************
  24. ;----------------------------
  25. ; checks if given program is installed, if not abort install
  26. ; #program - to check
  27.  
  28. (procedure P_ChkRun
  29.   (if
  30.     (= 0 (run ("cd SYS:\nWhich %s" #program)))
  31.     ("")
  32.     (abort 
  33.       (cat
  34.     "You must install \"" #program "\" first!\n"
  35.     "It must be accessible via the path.\n"
  36.     "You can find it in the WHDLoad package."
  37.       )
  38.     )
  39.   )
  40. )
  41.  
  42. ;----------------------------
  43. ; Create Image using DIC
  44. ; #dest        - path to save image in
  45. ; #CI_disknum  - number of the disk image to create
  46. ; #CI_diskname - label of the disk
  47. ; #CI_disklen  - length of disk image to create
  48. ; #CI_skiptrk  - track to skip, -1 means no skip
  49. ; #CI_drive    - drive to create image from
  50.  
  51. (procedure P_CreateImage
  52.   (message
  53.     (cat
  54.     "\nInsert \"" #CI_diskname "\" into drive " #CI_drive "!\n\n"
  55.     "(make sure it's the right disk because it will not be checked)"
  56.     )
  57.   )
  58.   (if
  59.     (>= #CI_skiptrk 0)
  60.     (set #option (cat " SKIPTRACK=" #CI_skiptrk))
  61.     (set #option "")
  62.   )
  63.   (if
  64.     (= 0
  65.       (run 
  66.         (cat
  67.           "cd \"" #dest "\"\n"
  68.           "DIC " #CI_drive " FD=" #CI_disknum " LD=" #CI_disknum " SIZE="
  69.           #CI_disklen #option " PEDANTIC >CON:///1000//CLOSE"
  70.         )
  71.       )
  72.     )
  73.     (run ("FileNote \"%s.%ld\" \"%s\" Quiet" (tackon #dest "disk") #CI_disknum @app-name))
  74.     (abort "\"DIC\" has failed to create a diskimage")
  75.   )
  76. )
  77.  
  78. ;****************************
  79.  
  80. (if
  81.   (exists #readme-file)
  82.   (if
  83.     (= 0 (run ("SYS:Utilities/Multiview %s" #readme-file)))
  84.     ("")
  85.     (run ("SYS:Utilities/More %s" #readme-file))
  86.   )
  87. )
  88.  
  89. (set #program "WHDLoad")
  90. (P_ChkRun)
  91.  
  92. (set #program "DIC")
  93. (P_ChkRun)
  94.  
  95. ; in expert mode ask for source drive
  96. (if
  97.   (= @user-level 2)
  98.   (
  99.     (set #CI_drive
  100.       (askchoice
  101.     (prompt "Select source drive for diskimages")
  102.     (default 0)
  103.     (choices "DF0:" "DF1:" "RAD:" "Enter Device")
  104.     (help @askchoice-help)
  105.       )
  106.     )
  107.     (select #CI_drive
  108.       (set #CI_drive "DF0:")
  109.       (set #CI_drive "DF1:")
  110.       (set #CI_drive "RAD:")
  111.       (set #CI_drive
  112.         (askstring
  113.           (prompt "Select source drive for diskimages")
  114.           (default "DF0:")
  115.           (help @askstring-help)
  116.         )
  117.       )
  118.     )
  119.   )
  120.   (set #CI_drive "DF0:")
  121. )
  122.  
  123. (set @default-dest
  124.   (askdir
  125.     (prompt 
  126.       (cat
  127.     "Where should \"" @app-name "\" be installed?\n"
  128.     "A drawer \"" @app-name "\" will be automatically created."
  129.       )
  130.     )
  131.     (help @askdir-help)
  132.     (default @default-dest)
  133.     (disk)
  134.   )
  135. )
  136. (set #dest (tackon @default-dest @app-name))
  137. (if
  138.   (exists #dest)
  139.   (
  140.     (set #choice
  141.       (askbool
  142.         (prompt
  143.           (cat
  144.             "\nDirectory \"" #dest "\" already exists.\n"
  145.             "Should it be deleted?"
  146.           )
  147.         )
  148.         (default 1)
  149.         (choices "Delete" "Skip")
  150.         (help @askbool-help)
  151.       )
  152.     )
  153.     (if
  154.       (= #choice 1)
  155.       (run ("Delete \"%s\" \"%s.info\" All" #dest #dest))
  156.     )
  157.   )
  158. )
  159. (makedir #dest
  160.   (help @makedir-help)
  161.   (infos)
  162. )
  163.  
  164. ;----------------------------
  165.  
  166. (copyfiles
  167.   (help @copyfiles-help)
  168.   (source ("%s.Slave" @app-name))
  169.   (dest #dest)
  170. )
  171. (if
  172.   (exists ("%s.newicon" @app-name))
  173.   (set #icon
  174.     (askchoice
  175.       (prompt "\nWhich icon would you like to install?\n")
  176.       (default 0)
  177.       (choices "Normal" "NewIcon")
  178.       (help @askchoice-help)
  179.     )
  180.   )
  181.   (set #icon 0)
  182. )
  183. (select #icon
  184.   (set #icon ("%s.inf" @app-name))
  185.   (set #icon ("%s.newicon" @app-name))
  186. )
  187. (copyfiles
  188.   (help @copyfiles-help)
  189.   (source #icon)
  190.   (newname ("%s.info" @app-name))
  191.   (dest #dest)
  192. )
  193. (tooltype
  194.   (dest (tackon #dest @app-name))
  195.   (settooltype "Slave" ("%s.Slave" @app-name))
  196.   (settooltype "PreLoad" "")
  197.   (setdefaulttool "WHDLoad")
  198.   (setstack 8192)
  199.   (noposition)
  200. )
  201. (if
  202.   (exists #readme-file)
  203.   (copyfiles
  204.     (help @copyfiles-help)
  205.     (source #readme-file)
  206.     (dest #dest)
  207.   )
  208. )
  209. (if
  210.   (exists ("%s.info" #readme-file))
  211.   (
  212.     (copyfiles
  213.       (help @copyfiles-help)
  214.       (source ("%s.info" #readme-file))
  215.       (dest #dest)
  216.     )
  217.     (tooltype
  218.       (dest (tackon #dest #readme-file))
  219.       (noposition)
  220.     )
  221.   )
  222. )
  223.  
  224. (P_MakeImages)
  225.  
  226. ;----------------------------
  227.  
  228. (exit)
  229.  
  230.